﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using Entities;

using System.Web;

namespace DataAccess
{
   public  class StockDA
    {
       ConnectDB cn = new ConnectDB();
       StockEntites stock_E = new StockEntites();
       public DataTable GetQuantity(StockEntites stock)
       {
           DataTable dt = Data.ExecuteStoredProcedureNoParam("PR_SelectQuantity");
           return dt;
       }

       public bool UpdateQuantityATM(StockEntites stock)
       {
           bool kt = false;
           try { 
            SqlConnection con = new SqlConnection(cn.ConnectionString());
           con.Open();
           SqlCommand cmd = new SqlCommand("PR_UpdateMoneyInATM", con);
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.Add(new SqlParameter("@Quantity", stock.Quantity));
           cmd.Parameters.Add(new SqlParameter("@MoneyID", stock.MoneyID));


           cmd.ExecuteNonQuery();
           cmd.Dispose();
               kt=true;
           }catch(Exception ex)
           {
               throw ex;
           }
           
           return kt;
       }
      
    }
}
